<?php
namespace App\Services\Permission;

use App\Services\BaseServices;
use App\Repositories\Permission\PermissionRepositoryEloquent;

class PermissionServices extends BaseServices
{

	protected $repository;

	function __construct(PermissionRepositoryEloquent $repository)
	{
		$this->repository = $repository;
	}
	
	/**
	 * 权限列表数据
	 * @author 晚黎
	 * @date   2020-01-12
	 * @return [type]     [description]
	 */
	public function getPermissionList()
	{
		return $this->getDatatableList($this->repository);
	}

	
	/**
	 * datatable 配置信息
	 * @author 晚黎
	 * @date   2020-01-13
	 * @return [type]     [description]
	 */
	public function getTableAttr()
	{
		$datatable['columns'] = [
            [
                'data' => 'id',
                'name' => 'id',
                'orderable' => false
            ],
            [
                'data' => 'name',
                'name' => 'name',
            ],
            [
                'data' => 'guard_name',
                'name' => 'guard_name',
                'orderable' => false
            ],
            [
                'data' => 'created_at',
                'name' => 'created_at',
            ],
            [
                'data' => 'updated_at',
                'name' => 'updated_at',
            ],
            [
            	'data' => 'id',
            	'type' => 'html',
            	'orderable' => false
            ]

        ];

        $datatable['thead'] = [
            '权限名称',
            '权限scope',
            '创建时间',
            '修改时间'
        ];

        return $datatable;
	}
}